<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #box1{
            height: 200px;
            width: 200px;
            background-color: red;
        }
        #btn{
            width: 200px;
        }
    </style>
</head>
<body>
    <div id="box1">1</div>
    <button id="btn">切换</button>
</body>
<script>
    let box1 = document.getElementById("box1");
    let btn = document.getElementById("btn");
    //找到页面的元素

    btn.onclick=function(){
        //干活的区间
        // box1.style.color = "yellow";
        box1.style.backgroundColor = "yellow";

    }


</script>
</html>